<?php 
    $this->headMeta()->appendHttpEquiv('Content-Type','text/html;charset=utf-8'); 
    $this->headTitle()->setSeparator(' - '); 
    $this->headTitle('3S'); 
    $auth = Zend_Auth::getInstance()->getIdentity(); 
    
    $params = Zend_Controller_Front::getInstance()->getRequest();
    
    $menuModule         = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
    $menuController     = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
    $menuAction         = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
    
    $dashId = ($params->getParam('dashId')) ? $params->getParam('dashId') : 0;
    $acl = new My_Acl();
        
    $modelUserRole = new Admin_Model_Userrole();
    $modelRole = new Admin_Model_Role();          
    $adRole = $modelUserRole->getDataByUserId($auth['adminId']);
        
    foreach($adRole as $key => $role){        
        $roleDetail = $modelRole->getDataByRoleId($role['roleId']);        
        if($adRole->count()==$key+1){
            $auth['strRole'] .= $roleDetail['roleName'];
        }else        
            $auth['strRole'] .= $roleDetail['roleName'].', ';
    }         
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html>
<!--<![endif]-->
<head>
    <base href="<?php echo BASE_URL1;?>" />
    <meta charset="utf-8"/>        
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>        				
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>						
	<link rel="icon" href="<?php echo BASE_URL;?>static/images/favicon.png"/>
	<?php echo $this->headMeta(); ?>
	<?php echo $this->headTitle(); ?>

    <!-- Le styles -->
    <link href="<?php echo BASE_URL ?>static/assets/css/lib/bootstrap.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/lib/bootstrap-responsive.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/extension.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/boo.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/style.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/style_extend.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/boo-coloring.css" rel="stylesheet">
    <link href="<?php echo BASE_URL ?>static/assets/css/boo-utility.css" rel="stylesheet">
    
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <script src="<?php echo BASE_URL ?>static/assets/plugins/selectivizr/selectivizr-min.js"></script>
        <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/excanvas.min.js"></script>
    <![endif]-->
    
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="<?php echo BASE_URL ?>static/assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo BASE_URL ?>static/assets/ico/apple-touch-icon-144-precomposed.html">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo BASE_URL ?>static/assets/ico/apple-touch-icon-114-precomposed.html">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo BASE_URL ?>static/assets/ico/apple-touch-icon-72-precomposed.html">
    <link rel="apple-touch-icon-precomposed" href="<?php echo BASE_URL ?>static/assets/ico/apple-touch-icon-57-precomposed.html">
    
</head>

<body class="sidebar-left panel-side">
<div class="page-container">
    <div id="header-container">
        <div id="header">
            <div class="navbar navbar-inverse navbar-fixed-top">
                <div class="navbar-inner">
                    <div class="container-fluid">
                        <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
                        <a class="brand" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'index', 'action'=>'index'))?>"><img src="<?php echo BASE_URL ?>static/assets/img/demo/logo-brand.png"/></a>
                        <div class="search-global">
                            <input id="globalSearch" class="search search-query input-medium" type="search"/>
                            <a class="search-button" href="javascript:void(0);"><i class="fontello-icon-search-5"></i></a> </div>
                        <div class="nav-collapse collapse">
                            <ul class="nav user-menu visible-desktop">
                                <li><a class="btn-glyph fontello-icon-edit tip-bc" href="javascript:void(0);" title="Messages"><span class="badge badge-important">8</span></a></li>
                                <li><a class="btn-glyph fontello-icon-mail-1 tip-bc" href="javascript:void(0);" title="Emails"></a></li>
                                <li><a class="btn-glyph fontello-icon-lifebuoy tip-bc" href="javascript:void(0);" title="Support"><span class="badge badge-important">4</span></a></li>
                            </ul>
                            <ul class="nav">
                                <li class="active"> <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'index', 'action'=>'index'))?>">Dashboard</a> </li>
                                <li> <a href="javascript:void(0);">Components</a> </li>
                                <li> <a href="component-fullcalendar-demo.html"><span class="fontello-icon-calendar"></span>Calendar</a> </li>
                                <li> <a href="javascript:void(0);"><span class="fontello-icon-users"></span>Contacts</a> </li>
                                <li class="dropdown"> <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown"><span class="fontello-icon-list-1"></span>Customize <b class="caret"></b></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="component-form-demo.html">Demo Form</a></li>
                                        <li><a href="component-widgets-remember.html">Remember</a></li>
                                        <li><a href="component-widgets-users.html">User List</a></li>
                                        <li class="divider"></li>
                                        <li class="nav-header">Next Update</li>
                                        <li><a href="javascript:void(0);">Contacts</a></li>
                                        <li><a href="javascript:void(0);">Email</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <!-- // navbar -->
            
            <div class="header-drawer">
                <div class="mobile-nav text-center visible-phone"> <a href="javascript:void(0);" class="mobile-btn" data-toggle="collapse" data-target=".sidebar"><i class="aweso-icon-chevron-down"></i> Components</a> </div>
                <!-- // Resposive navigation -->
                <?php
                    
                	$modelResource = new Admin_Model_Resource();                                        
                    $resource = $modelResource->getData(array('moduleName'=>'admin','controllerName'=>$menuController,'actionName'=>$menuAction));                    
                    $actionSon = $modelResource->getData(array('controllerName'=>$menuController,'displayTemplate'=>1));                     
                ?>                                
                <div class="breadcrumbs-nav hidden-phone">
                    <ul id="breadcrumbs" class="breadcrumb">
                        <li>
                            <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'index', 'action'=>'index'));?>"><i class="fontello-icon-home f12"></i> Dashboard</a><span class="divider">/</span>
                        </li>
                        <li class="dropdown"><a><?php echo $resource[0]['controllerNameShowup'] ?> </a> <span class="divider">/</span>
                            <ul class="dropdown-menu">
                                <?php                                                                       
                                	foreach($actionSon as $action){                                	   
                                        echo '<li><a href="'.$this->url(array('module'=>'admin', 'controller'=>$action['controllerName'], 'action'=>$action['actionName'])).'">'.$action['actionNameShowup'].'</a></li>';	   
                                	}
                                ?>                                                                                            
                            </ul>
                        </li>
                        <li class="active"><?php echo $resource[0]['actionNameShowup'];?> </li>
                    </ul>
                </div>
                <!-- // breadcrumbs --> 
            </div>
            <!-- // drawer --> 
        </div>
    </div>
    <!-- // header-container -->
    
    <div id="main-container">
        <div id="main-sidebar" class="sidebar sidebar-inverse">
            <div class="sidebar-item">
                <div class="media profile">
                    <div class="media-thumb media-left thumb-bordereb"> <a class="img-shadow" href="javascript:void(0);"><img class="thumb" src="<?php echo BASE_URL ?>static/assets/img/demo/demo-avatar9604.jpg"/></a> </div>
                    <div class="media-body">
                        <h5 class="media-heading"><?php echo $auth['username'];?><small>as <?php echo $auth['strRole']?></small></h5>
                        <p class="data">Last Access: 16 May 15:30</p>
                    </div>
                </div>
            </div>
            <!-- // sidebar item - profile -->
            
            <?php
            	//sidebar menu                
                if(!isset($_COOKIE['menuActive'])){
                   setcookie("menuActive","accDashboard",time()+20000000,"/");                                            
                }                
                                        
                $listAllow = $acl->listResourceAllowed();                
                $listMenu = array();
                $listMenuId = array();
                
                foreach($listAllow as $row){
                    $listMenuId = $row['resourceId'];
                    if(!in_array($row['menuModel'], $listMenu)){
                        $listMenu[] = $row['menuModel'];
                    }
                }    
                //pr($listMenu);
            ?>            
            <ul id="mainSideMenu" class="nav nav-list nav-side">                
                <?php                                                      
                	foreach($listMenu as $menu){                	    
                        $menuSon = $modelResource->getData(array('displayTemplate'=>1,'menuModel'=>$menu));                                                                                            
                        $faHref = '#acc_'.$menu;                                                                                                                                                                                     
                        $faModel = 'acc_'.$menu;
                        $menuName = $menuSon[0]['menuName'];                                                                                                                                             
                ?>
                        <li class="accordion-group">
                            <div class="accordion-heading <?php if($_COOKIE['menuActive']==$faModel)echo 'active';?>"> 
                                <a href="<?php echo $faHref ?>" data="<?php echo $faModel ?>" data-parent="#mainSideMenu" data-toggle="collapse" class="accordion-toggle">
                                    <span class="item-icon aweso-icon-list-alt"></span>
                                    <i class="chevron fontello-icon-right-open-3"></i>
                                    <?php echo $menuName?>
                                </a>
                            </div>                            
                            <ul class="accordion-content nav nav-list collapse <?php if($_COOKIE['menuCheck']==$faModel)echo 'in';?>" id="<?php echo $faModel ?>" <?php if($_COOKIE['menuCheck']==$faModel)echo 'style="height:auto"';?>>
                                <?php                                    
                                        foreach($menuSon as $menuSonItem){
                                    	   echo '<li> <a href="'.'admin/'.$menuSonItem['controllerName'].'/'.$menuSonItem['actionName'].'"> <i class="fontello-icon-right-dir"></i> '.$menuSonItem['actionNameShowup'].' </a> </li>';
                                    	}                                                                        	
                                ?>                                                                                                                    
                            </ul>
                        </li>   
                <?php                	   
                    }
                ?>                             
                <!-- // item accordionMenu -->
                <!--<li class="accordion-group">
                    <div class="accordion-heading <?php if($_COOKIE['menuActive']=='accNews')echo 'active';?>"> 
                        <a href="#accNews" data="accNews" data-parent="#mainSideMenu" data-toggle="collapse" class="accordion-toggle">
                            <span class="item-icon aweso-icon-list-alt"></span>
                            <i class="chevron fontello-icon-right-open-3"></i> Tin tức Một
                        </a> 
                    </div>
                    <ul class="accordion-content nav nav-list collapse <?php if($_COOKIE['menuCheck']=='accNews')echo 'in';?>" id="accNews" <?php if($_COOKIE['menuCheck']=='accNews')echo 'style="height:auto"';?>>
                        <li> <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'newscat', 'action'=>'index'))?>"> <i class="fontello-icon-right-dir"></i> Danh mục </a> </li>
                        <li> <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'news', 'action'=>'index'))?>"> <i class="fontello-icon-right-dir"></i> Quản lý tin</a> </li>                        
                    </ul>
                </li>-->                   
            </ul>
            <br />
            <!-- // sidebar menu -->
            
            <div class="sidebar-item"></div>
            <!-- // sidebar item --> 
            
        </div>
        <!-- // sidebar -->
        
        <div id="main-content" class="main-content container-fluid">        
            <?php                                
                echo $this->layout()->content;                 
            ?>            
        </div>
        <!-- // main-content --> 
        
    </div>
    <!-- // main-container  -->
    
    <footer id="footer-fix">
        <div id="footer-sidebar" class="footer-sidebar">
            <div class="navbar">
                <div class="btn-toolbar"> <a class="btn btn-glyph btn-link" href="javascript:void(0);"><i class="fontello-icon-up-open-1"></i></a> </div>
            </div>
        </div>
        <!-- // footer sidebar -->
        
        <div id="footer-content" class="footer-content">
            <div class="navbar navbar-inverse">
                <div class="navbar-inner">
                    <ul class="nav pull-left">
                        <li class="divider-vertical hidden-phone"></li>
                        <li><a id="btnToggleSidebar" class="btn-glyph fontello-icon-resize-full-2 tip hidden-phone" href="javascript:void(0);" title="show hide sidebar"></a></li>
                        <li class="divider-vertical hidden-phone"></li>
                        <li><a id="btnChangeSidebar" class="btn-glyph fontello-icon-login tip hidden-phone" href="javascript:void(0);" title="change sidebar position"></a></li>
                        <li class="divider-vertical"></li>
                        <li><a id="btnChangeSidebarColor" class="btn-glyph fontello-icon-palette tip" href="javascript:void(0);" title="change sidebar color"></a></li>
                        <li class="divider-vertical"></li>
                        <li><a class="btn-glyph fontello-icon-cw" href="javascript:void(0);"></a></li>
                        <li class="divider-vertical"></li>
                        <li><a class="fontello-icon-home-3" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'index', 'action'=>'index'))?>"></a></li>
                        <li class="divider-vertical"></li>
                    </ul>
                    <ul class="nav pull-right">
                        <!--<li class="divider-vertical"></li>
                        <li><a class="btn-glyph fontello-icon-help-2 tip" href="javascript:void(0);" title="help to page"></a></li>
                        <li class="divider-vertical"></li>
                        <li><a class="btn-glyph fontello-icon-cog-4 tip" href="javascript:void(0);" title="settings app"></a></li>-->
                        <li class="divider-vertical"></li>
                        <li><a id="btnLogout" class="btn-glyph fontello-icon-logout-1 tip" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'auth', 'action'=>'logout'))?>" title="logout"></a></li>
                        <li class="divider-vertical"></li>
                        <li><a id="btnScrollup" class="scrollup btn-glyph fontello-icon-up-open-1" href="javascript:void(0);"><span class="hidden-phone">Scroll</span></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- // footer content --> 
        
    </footer>
    <!-- // footer-fix  --> 
    
</div>
<!-- // page-container  --> 

    <!-- Le javascript --> 
    <!-- Placed at the end of the document so the pages load faster --> 
    <!-- <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-wysihtml5/lib/js/wysihtml5-0.3.0.min.js"></script> -->
    <script src="<?php echo BASE_URL ?>static/assets/js/lib/jquery.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/js/lib/jquery-ui.js"></script>
    <script src="<?php echo BASE_URL ?>static/assets/js/lib/bootstrap.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/js/lib/jquery.cookie.js"></script> 
    
    <!-- Plugins Bootstrap --> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-timepicker/js/bootstrap-timepicker.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-daterangepicker/js/date.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-daterangepicker/js/bootstrap-daterangepicker.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-rowlink/js/bootstrap-rowlink.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-progressbar/js/bootstrap-progressbar.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-wysihtml5/src/bootstrap-wysihtml5.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-select/bootstrap-select.js"></script>
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-bootbox/bootbox.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-modal/js/bootstrap-modalmanager.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-modal/js/bootstrap-modal.js"></script>
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-wizard/js/bootstrap-wizard.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/bootstrap-toggle-buttons/js/bootstrap-toggle-buttons.js"></script>
    
    <!-- Plugins Custom -->
    <script src="<?php echo BASE_URL ?>static/assets/plugins/google-code-prettify/prettify.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/nicescroll/jquery.nicescroll.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/qtip2/dist/jquery.qtip.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/list/js/list.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/list/plugins/list.paging.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/fullcalendar/fullcalendar.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/friendlyurl/jquery.friendurl.min.js"></script>
    
    <!-- Plugins Forms --> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/uniform/jquery.uniform.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/select2/select2.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/counter/jquery.counter.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/elastic/jquery.elastic.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/inputmask/jquery.inputmask.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/inputmask/jquery.inputmask.extensions.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/validate/js/jquery.validate.min.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/xbreadcrumbs/xbreadcrumbs.js"></script> 
    
    <!-- Charts --> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/sparkline/jquery.sparkline.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.categories.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.grow.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.orderBars.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.pie.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.resize.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.selection.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.stack.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.stackpercent.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/flot/jquery.flot.time.js"></script> 
    
    <!-- Plugins Tables --> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/datatables/media/js/jquery.dataTables.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/datatables/plugin/jquery.dataTables.plugins.js"></script> 
    <script src="<?php echo BASE_URL ?>static/assets/plugins/datatables/plugin/jquery.dataTables.columnFilter.js"></script>
    <script src="<?php echo BASE_URL ?>static/assets/plugins/datatables/plugin/jquery.dataTables.rowReordering.js"></script>
         
    
    <!-- main js -->
    <script src="<?php echo BASE_URL ?>static/assets/js/application.js"></script>  
    <script src="<?php echo BASE_URL ?>static/assets/js/application_extend.js"></script>            
    
    <!-- Controller Script  -->
    <?php echo $this->headScript() ?> 

</body>
</html>
